<?php
/**
 * RedCross Application
 *
 * @copyright Copyright (c) 2010, Kristian Stokke Tryggestad, Rune Vikestad, Andreas Flaten Wist, Simen Nicolai Echholt, Ole Henrik Jahren
 */


class RedCross_View_Helper_Acl extends Zend_View_Helper_Abstract
{
    private $_acl;

    public function __construct()
    {
        $bootstrap = Zend_Controller_Front::getInstance()->getParam('bootstrap');
        $this->_acl = $bootstrap->getResource('Acl');
    }

    public function acl()
    {
        return $this;
    }

	public function isAllowed($resource = null, $privilege = null)
	{
        return $this->_acl->isAllowed($this->_acl->retrieveRole(), $resource, $privilege);
	}

	public function getAcl()
	{
        return $this->_acl;
	}

	public function getRole()
	{
        return $this->_acl->retrieveRole();
	}

    public function getParents()
    {
        return $this->_acl->getParentsForRole();
    }
}